package com.gdyzy.common;

import lombok.Data;

import java.io.Serializable;

@Data
public class R<T> implements Serializable {
    private Integer code;
    private String message;
    private T data;

    public static <T> R<T> success(String message, T data) {
        R<T> r = new R<>();
        r.code = 1;
        r.message = message;
        r.data = data;
        return r;
    }

    public static <T> R<T> error(String message) {
        R r = new R();
        r.message = message;
        r.code = 0;
        return r;
    }
}
